package org.springframework.core.io;

import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;

import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @className：DefaultResourceLoader
 * @description:
 * @author: xiaohuihui
 * @createDate: 2021/8/29
 * @version: 1.0
 */
public class DefaultResourceLoader implements ResourceLoader {

    @Nullable
    private ClassLoader classLoader;

    private final Set<ProtocolResolver> protocolResolvers = new LinkedHashSet<>(4);

    private final Map<Class<?>, Map<Resource,?>> resourceCaches = new ConcurrentHashMap<>(4);

    /**
     * 创建一个新的DefaultResourceLoader
     * ClassLoader访问将在此DefaultResourceLoader初始化时使用线程上下文类加载器进行
     * @see java.lang.Thread#getContextClassLoader()
     */
    public DefaultResourceLoader(){
        this.classLoader = ClassUtils.getDefaultClassLoader();
    }
}
